import { Http } from '@/utils';

export async function fetchUser(params: {}) {
  const ret = await Http(
    {
      url: '/user/detail',
      method: 'post',
      params,
    },
    false,
  );

  return ret;
}

export async function fetchEditUser(payload: {}) {
  const ret = await Http(
    {
      url: '/user/edit',
      method: 'PUT',
      data: payload,
    },
    false,
    false,
  );
  return ret;
}

export async function fetchLogin(payload: {}) {
  const ret = await Http(
    {
      url: '/user/login',
      method: 'post',
      data: payload,
    },
    false,
    false,
  );

  return ret;
}

export async function fetchLoginOut(payload: {}) {
  const ret = await Http(
    {
      url: '/user/logout',
      method: 'post',
      data: payload,
    },
    false,
    false,
  );

  return ret;
}

export async function fetchRegister(payload: {}) {
  const ret = await Http(
    {
      url: '/user/register',
      method: 'post',
      data: payload,
    },
    false,
    false,
  );
  return ret;
}
